<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h2>ES5版本类继承</h2>
</body>
<script>
    //人类  
    function Person(name = '无名') {
        this.name = name
    }

    //添加原型方法
    Person.prototype.getUserInfo = function() {
        return `我的名称叫${this.name}`
    }

    //中国人
    function Chinese(name) {
        //借用构造函数继承
        Person.call(this, name)
        this.theme = '黄皮肤'
    }

    Chinese.prototype = new Person()

    const c1 = new Chinese('张三')
    console.log(c1.getUserInfo())
</script>

</html>